import request from '@/utils/request'

/**
 * 部门分类列表
 * @param params
 */
export function fetchDeptList(params: any = {}) {
  return request({
    url: '/zgyp-system/api/v1/dept',
    method: 'get',
    params,
  })
}

export function getDetail(params?: any) {
  return request({
    url: `/zgyp-system/api/v1/dept/${params.deptId}/form`,
    method: 'get',
    params,
  })
}

export function doEdit(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dept/${data.id}`,
    method: 'put',
    data,
  })
}

export function doAdd(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dept`,
    method: 'post',
    data,
  })
}

export function doDelete(data: any) {
  return request({
    url: `/zgyp-system/api/v1/dept/${data.ids}`,
    method: 'DELETE',
    data,
  })
}

export function getDeptTreeList(data?: any) {
  return request({
    url: '/zgyp-system/api/v1/dept/listOptions',
    method: 'post',
    data,
  })
}
